package com.cskaoyan.market.controller;

import com.cskaoyan.market.db.domain.MarketComment;
import com.cskaoyan.market.service.MarketAdminCommentService;
import com.cskaoyan.market.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServlet;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: MYM
 * @Date: 2024/05/08/16:08
 * @Description:
 */
@RestController
@RequestMapping("/admin/comment/*")
public class AdminCommentController extends HttpServlet {
    @Autowired
    private MarketAdminCommentService commentService;

    @GetMapping("/list")
    private Object list(Integer page, Integer limit, Integer userId, Integer valueId, String sort, String order) {
        List<MarketComment> comments =(commentService.list(page, limit, userId, valueId, sort, order));
        return ResponseUtil.okList(comments);
    }

    @PostMapping("/delete")
    private Object delete(@RequestBody MarketComment comment) {
        commentService.delete(comment.getId());;
        return ResponseUtil.ok();
    }
}
